function selectYsgs(tplcode){
	var title = "请选择运输公司";
	ExtElYsgsWin({id: 'selectYsgs', title: title, w: 550, h: 400, tplcode: tplcode});
}

function ExtElYsgsWin(f) {
  var w = 350;
  var h = 160;
  if (f.w) w = f.w;
  if (f.h) h = f.h;
  
  var ysgsGrid = new Ext.ux.grid.YwGrid({
    region: 'center',
    layout: 'fit',
    tplcode: f.tplcode,
    needSelect4CsdlwjTbar:true,
    url: '/yw-com-ysgs!findYsgs.action?templateCode='+f.tplcode,
    keyField: 'id',
    defaultSortField: 'ysgs',
    structure: [{
      name: 'id',
      hidden: true
    },{
      name: 'ysgsLxr',
      hidden: true
    },{
      name: 'ysgsLxrLxdh',
      hidden: true
    },{
      name: 'templateCode',
      hidden: true
    },{
      name: 'ysgs',
      header: '运输公司名称'
    },{
      name: 'sqrq',
      header: '申请日期',
       hidden: true,
      width: 17
    }]
  });
  
  var store = ysgsGrid.store;
  var toolbar = ysgsGrid.toolbar;
  store.on('beforeload', function(){
    store.baseParams = {
      ysgs: toolbar.search_sqdw.getValue()
    };
  }, this);
  
  new Ext.Window({
    id        : f.id,
    title     : f.title,
    width     : w,
    height    : h,
    iconCls   : 'icon_title',
    layout    : 'fit',
    modal     : true,
    plain     : true,
    resizeable: false,
    items     : [ysgsGrid]
  }).show();
}

function selectYsgsCallback(params){
	try{
			if(document.forms[0].ysgsId && params.r.get('id'))
				document.forms[0].ysgsId.value = params.r.get('id');
			if(document.forms[0].ysgsLxr && params.r.get('ysgsLxr'))
				document.forms[0].ysgsLxr.value = params.r.get('ysgsLxr');
			if(document.forms[0].ysgsLxrLxdh && params.r.get('ysgsLxrLxdh'))
				document.forms[0].ysgsLxrLxdh.value = params.r.get('ysgsLxrLxdh');
			if(document.forms[0].ysgs && params.r.get('ysgs'))
				document.forms[0].ysgs.value = params.r.get('ysgs');
		}catch(e){}	
}